package com.peas.platform.module.icims.expenditure.disbursement.api;

import com.peas.platform.common.core.dto.ResponseDto;
import com.peas.platform.module.icims.expenditure.disbursement.api.req.*;
import com.peas.platform.module.icims.expenditure.disbursement.dto.ExpenditureInternetbankDto;
import com.peas.platform.module.icims.expenditure.disbursement.dto.ExpenditureTreasuryDto;
import com.peas.platform.module.icims.expenditure.disbursement.service.ExpenditureInternetbankService;
import com.peas.platform.module.icims.expenditure.disbursement.service.ExpenditureTreasuryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "自定义接口-[收支控制]支出管理")
@RestController
@RequestMapping("/api/v1/customDisbursement")
public class CustomDisbursementController {

    @Resource
    private ExpenditureTreasuryService expenditureTreasuryService;
    @Resource
    private ExpenditureInternetbankService expenditureInternetbankService;

    @ApiOperation(value = "编辑保存国库支付令")
    @PostMapping(value = "/saveExpenditureTreasury")
    public ResponseDto<ExpenditureTreasuryDto> saveExpenditureTreasury(@RequestBody @Valid SaveExpenditureTreasuryReq vo) {
        ExpenditureTreasuryDto dto = expenditureTreasuryService.saveExpenditureTreasury(vo);
        return ResponseDto.getSuccessResponseDto(dto);
    }

    @ApiOperation(value = "编辑提交国库支付令")
    @PostMapping("/submitExpenditureTreasury")
    public ResponseDto<Boolean> submitExpenditureTreasury(@RequestBody @Valid SubmitExpenditureTreasuryReq vo) {
        expenditureTreasuryService.submitExpenditureTreasury(vo);
        return ResponseDto.getSuccessResponseDto(true);
    }

    @ApiOperation(value = "录入国库支付令号")
    @PostMapping("/exchequerExpenditureTreasury")
    public ResponseDto<Boolean> exchequerExpenditureTreasury(@RequestBody @Valid ExchequerExpenditureTreasuryReq vo) {
        expenditureTreasuryService.exchequerExpenditureTreasury(vo);
        return ResponseDto.getSuccessResponseDto(true);
    }

    @ApiOperation(value = "编辑保存网银支付")
    @PostMapping(value = "/saveExpenditureInternetbank")
    public ResponseDto<ExpenditureInternetbankDto> saveExpenditureInternetbank(@RequestBody @Valid SaveExpenditureInternetbankReq vo) {
        ExpenditureInternetbankDto dto = expenditureInternetbankService.saveExpenditureInternetbank(vo);
        return ResponseDto.getSuccessResponseDto(dto);
    }

    @ApiOperation(value = "编辑提交网银支付")
    @PostMapping("/submitExpenditureInternetbank")
    public ResponseDto<Boolean> submitExpenditureInternetbank(@RequestBody @Valid SubmitExpenditureInternetbankReq vo) {
        expenditureInternetbankService.submitExpenditureInternetbank(vo);
        return ResponseDto.getSuccessResponseDto(true);
    }

    @ApiOperation(value = "录入网银支付流水")
    @PostMapping("/transactionExpenditureInternetbank")
    public ResponseDto<Boolean> transactionExpenditureInternetbank(@RequestBody @Valid TransactionExpenditureInternetbankReq vo) {
        expenditureInternetbankService.transactionExpenditureInternetbank(vo);
        return ResponseDto.getSuccessResponseDto(true);
    }

}
